<template>
  <div class="layout">
    <!-- 导航头（始终显示） -->
    <NavHeader />
    <!-- 动态内容区域 -->
    <main class="content">
      <!-- 使用 Element 响应式栅格 -->
      <el-row :gutter="20">
        <el-col :span="6">
          <el-menu
            :default-active="activeIndex"
            class="el-menu-demo"
            mode="vertical"
            :ellipsis="false"
            @select="handleSelect">
            <el-menu-item index="1">动态</el-menu-item>
            <el-menu-item index="2">我的文章</el-menu-item>
            <el-menu-item index="3">我的收藏</el-menu-item>
            <el-menu-item index="4">我的评论</el-menu-item>
            <el-menu-item index="5">我的消息</el-menu-item>
          </el-menu>
        </el-col>
        <el-col :span="18">
          <router-view></router-view>
        </el-col>
      </el-row>
   
    </main>
    <!-- 其他全局组件（如页脚） -->
  </div>
</template>

<script setup>
import NavHeader from "@/components/NavHeader.vue";
import { onMounted } from "vue";
onMounted(async () => {
  if (!localStorage.getItem("authorization")) {
    await router.push("/userLogin");
    ElMessage.error("登录已过期，请重新登录");
    return;
  }
})
</script>

<style scoped>



</style>
